<!DOCTYPE HTML>
<html>
<head>
    {include file="common:meta"}
    <style>
        .query-content div{
            float: left;
            margin-right: 20px;
        }
        .btn-margin{
            margin-right: 10px;
        }

        .query-custom{
            float:left;
        }
    </style>
</head>
<body>
<input type="hidden" value="{$user_id}" id="user_id"/>
<div class="page-container">
    <div class="ibox float-e-margins">
        <div class="ibox-content">

            <div class="form-group">
                <label class="control-label">
                    <label class="control-label">开始时间：
                        <input type="text" class="form-control date-search" id="start_time" placeholder="">
                    </label>
                    <label class="control-label">结束时间：
                        <input type="text" class="form-control date-search" id="end_time" placeholder="">
                    </label>
                </label>
                <button type="button" class="btn btn-primary" id="eventQuery">查询</button>
            </div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>app充值</th>
                    <th>官方充值</th>
                    <th>厅主充值</th>
                    <th>总数</th>
                </tr>
                </thead>
                <tbody >
                    <tr id="info">

                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
{include file="common:footer"}
<script>
    //getData();
    //时间搜索插件
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        lay('.date-search').each(function () {
            laydate.render({
                elem: this,
                type: 'datetime',
                trigger: 'click',
                format: 'yyyy-MM-dd HH:mm:ss'
            });
        });
    });
    $("#eventQuery").click(function () {
        getData();
    });
    //获取收入数据
    function getData(){
          var  start_time = $('#start_time').val(),
            end_time = $('#end_time').val(),
            user_id = $('#user_id').val();
        var datas = {
            start_time:start_time,
            end_time:end_time,
            user_id:user_id
        };
        $.ajax({
            type:'get',
            url:'/UserDiamondsSourceData',
            data:datas,
            dataType:'json',
            success:function(re){
                // console.log(result);
                if(re.code == 100){
                    var htmlElement = '',data = re.data;

                    htmlElement += "<td>"+ data.w_recharge + "</td><td>"+ data.a_recharge +"</td><td>"+ data.h_recharge +"</td><td>"+ data.t_recharge +"</td>";

                    $('#info').html(htmlElement);
                }
                else{
                    $('#info').empty();
                }
            },
            error:function(err){
                layer.msg('服务器开小差了！',{
                    time:2000
                });
            }
        });
    }
</script>
</body>
</html>